package com.awesome.imagedemo.util

import java.io.File
import java.io.FileInputStream

/**
 * Author: zhangjingfang
 * Email:zhangjingfang@jeejio.com
 * Date: 2021/11/25
 * Description:文件工具类
 */
/**
 * 是否为gif图
 */
@ExperimentalStdlibApi
fun isGif(file: File): Boolean {
    val fis = FileInputStream(file)
    val b = ByteArray(3)
    fis.read(b, 0, b.size)
    close(fis)
    if (b[0] == 'G'.code.toByte() && b[1] == 'I'.code.toByte() && b[2] == 'F'.code.toByte()) {
        return true
    }
    return false
}